<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./css/动态创建节点.css">
</head>
<body>
    <script>
        var navData = [
            {
                title:'京东五金城'
            },
            {
                title:'京东超市'
            },
            {
                title:'秒杀'
            },
            {
                title:'京东家电'
            },
            {
                title:'京东生鲜'
            },
        ]
        var box = document.createElement("div");
        box.classList.add("box");
        document.body.appendChild(box);
        var i = 0;
        while(i++<navData.length-1){
            var div = document.createElement("div");
            div.classList.add("item");
            div.textContent = navData[i].title;
            box.appendChild(div);
        }
    </script>
</body>
</html>